﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "CommonContent")]
    public class CommonContentInfo : IDetach
    {
        public CommonContentInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private string _detailcontent = "";

        private EntitySet<AttachmentsInfo> _attachmentsInfo;
        [Association(Storage = "_attachmentsInfo", ThisKey = "Id", OtherKey = "ContentId")]
        public EntitySet<AttachmentsInfo> AttachmentsInfo
        {
            get { return this._attachmentsInfo; }
            set { this._attachmentsInfo.Assign(value); }
        }

        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("内容")]
        public string DetailContent
        {
            set { _detailcontent = value; }
            get { return _detailcontent; }
        }
        #endregion Model

        public void Detach()
        {
            this._attachmentsInfo = new EntitySet<AttachmentsInfo>();
        }
    }
}
